package nftot;

import bd.ConBdSqlS;
import bd.Dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
import nfe.Nfe;

/**
 *
 * @author Camilo
 */
public class NotaFiscalTotalDao implements Dao {

  private Connection con;

  public NotaFiscalTotalDao() throws SQLException {
    this.con = ConBdSqlS.getConexao();
  }

  public void adicionar(Nfe nfe) throws SQLException {
    //  Código SQL
    String sql = "INSERT INTO notafiscaltotal(Id, NotaFiscal, BaseICMS, ValorICMS, BaseICMSSub, ValorICMSSub,"
            + " IPI, ValorNota, Desconto, Frete, Seguro, Outras)"
            + "VALUES (?,?,?,?,?,?,"
            + "?,?,?,?,?,?)";
    PreparedStatement stmt = con.prepareStatement(sql);// Prepara a conexão
//  Define os valores dos parâmetros
    stmt.setString(1, nfe.getID().toString());
    stmt.setString(2, nfe.getID().toString());
    stmt.setString(3, nfe.getBaseICMS().toString());
    stmt.setString(4, nfe.getValorICMS().toString());
    stmt.setString(5, nfe.getBaseICMSsub().toString());
    stmt.setString(6, nfe.getValorICMSsub().toString());
    stmt.setString(7, nfe.getValorIPI().toString());
    stmt.setString(8, nfe.getValorNota().toString());
    stmt.setString(9, nfe.getValorDesconto().toString());
    stmt.setString(10, nfe.getValorFrete().toString());
    stmt.setString(11, nfe.getValorSeguro().toString());
    stmt.setString(12, nfe.getValorOutras().toString());
    stmt.execute(); // Executa o código SQL
    stmt.close(); // Encerra a conexão
  }

  @Override
  public void adicionar(Class pme) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
  }

  @Override
  public List<Object> getLista(String param) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
  }

  @Override
  public void altera(Object c1) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
  }

  @Override
  public void remove(Object c1) throws SQLException {
    throw new UnsupportedOperationException("Not supported yet.");
  }
}
